<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
    protected function _initSession(){
		Zend_Session::start();
		$key = 'gasmarked';
		Zend_Registry::set('keyApp',$key);
	}
	
	protected function _initDb(){
		$options = $this->getOption('resources');
		$dbOption = $options['db'];
		/*
		$dbOption['params']['username'] = 'root';
		$dbOption['params']['password'] = '';
		$dbOption['params']['dbname'] = 'gasmarked';
		$adapter = $dbOption['adapter'];
		$config = $dbOption['params'];*/
		
		$db = Zend_Db::factory($dbOption['adapter'],$dbOption['params']);
		$db->setFetchMode(Zend_Db::FETCH_ASSOC);
		$db->query("SET NAMES 'utf8'");
        $db->query("SET CHARACTER SET 'utf8'");
		Zend_Registry::set('connectDB',$db);
        Zend_Db_Table::setDefaultAdapter($db);
        return $db;
	}
	
	protected function _initFrontcontroller(){
		$front = Zend_Controller_Front::getInstance();
		$front->addModuleDirectory(APPLICATION_PATH . '/modules');
		$front->setDefaultModule('default');
		//$front->registerPlugin(new Zendvn_Plugin_Permission());
			
		return $front;
	}
}
